/*
 * @Author: your name
 * @Date: 2021-09-13 13:19:36
 * @LastEditTime: 2021-09-13 14:00:04
 * @LastEditors: your name
 * @Description: In User Settings Edit
 * @FilePath: \team\src\router\hook.js
 */
import store from '@/store'

// 检查用户是事已经登录
export const checkLoginHook = (to, from, next) => {
  if (to.meta.role) {
    next()
  } else {
    console.log(store.getters.token);
    // 判断当前操作有没有token值
    if (store.getters.token) {
      next()
    } else {
      next({ path: '/login', replace: true })
    }
  }
}

